<html>
<head>
<title>VoIP System</title>
</head>
<body>
	<%@ page import="pl.edu.agh.mobicentsVoIP.core.User"%>
	<%@ page import="pl.edu.agh.mobicentsVoIP.core.Call"%>
	<%@ page import="pl.edu.agh.mobicentsVoIP.core.CallStatus"%>
	<%@ page import="pl.edu.agh.mobicentsVoIP.database.HSQLFacade"%>
	<%@ include file="banner.jsp" %>
	<hr />
	<h3>
		Witaj
		<%=request.getRemoteUser()%></h3>
	<hr>
	<h4>Przeprowadzone rozmowy:</h4>
	<table border="1">
		<tr><th>Nadawca</th><th>Odbiorca</th><th>Start</th><th>Koniec</th><th>Status</th></tr>
		<%
			HSQLFacade facade = new HSQLFacade(); 
			User user = facade.getUser(request.getRemoteUser());
			for(Call c : facade.getAllUserCalls(user)){
				out.println("<tr><td>"+c.getFrom().getName()
						+"</td><td>"+c.getTo().getName()
						+"</td><td>" + c.getFormatedStart()
						+"</td><td>" + c.getFormatedEnd()
						+"</td><td>"+c.getStatus().toString()+"</td></tr>");
			}
		%>
		</table>
	<br><hr>
</body>
</html>